package com.chixing.config;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.model.JDBCDataModel;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class DataConfig {
   @Bean
   public DataModel getMySQlDataModel(){
       MysqlDataSource dataSource = new MysqlDataSource();
       dataSource.setUser("root");
       dataSource.setPassword("123456");
       dataSource.setDatabaseName("pet_shop");

       JDBCDataModel dataModel = new MySQLJDBCDataModel(dataSource,"cuslike","customer_id","product_id","like_value","like_time");
       return  dataModel;
   }
}
